package com.woniu.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.woniu.entity.CtfContainer;
import com.woniu.entity.CtfContest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.entity.CtfRange;
import com.woniu.entity.vo.CtfContestSituation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author nanqiao
* @description 针对表【ctf_contest(考试)】的数据库操作Mapper
* @createDate 2025-06-10 12:15:44
* @Entity com.woniu.entity.CtfContest
*/
@Mapper
public interface CtfContestMapper extends MPJBaseMapper<CtfContest> {


    /**
     * 根据 contest_id 查询对应的 container_id 数据
     * @param contestId 考试 ID
     * @return 容器列表
     */
    @Select("SELECT c.* FROM ctf_container c JOIN rel_contest_container cc ON c.container_id = cc.container_id WHERE cc.contest_id = #{contestId}")
    List<CtfContainer> selectContainersByContestId(Integer contestId);


    List<CtfContest> selectContestsByUserId(Integer userId);

    List<CtfContestSituation> selectContestByUserName(String userName);
}




